package my.multithreadtest;

class Daemon extends Thread{
	private Thread[] threads = new Thread[10];
	public Daemon (){
		setDaemon(true);
		start();
	}
	public void run(){
		for(int i=0;i<threads.length;i++){
			threads[i]=new DaemonSpawn(i);
			System.out.println("t["+i+"].isDaemon()="+threads[i].isDaemon());
		}
		while(true){
			yield();
		}

	}
}
class DaemonSpawn extends Thread{
	public DaemonSpawn(int i){
		start();
		System.out.println("DaemonSpawn "+ i +" Start");
	}
	public void run(){
		while(true){
			yield();
		}
	}
}
public class Daemons{

	/**
	 * @param args
	 * @throws InterruptedException 
	 */
	@SuppressWarnings("unused")
	public static void main(String[] args) throws InterruptedException {
		// TODO Auto-generated method stub
		Thread d=new Daemon();
		Thread.sleep(1000);
	}

}
